import i18n from '@/locales'
// 管理员密码选择配置
export const LOGIN_TYPES_MAP = {
  random: {
    label: i18n.t('db.text_1'),
    key: 'random',
  },
  keypair: {
    label: i18n.t('db.text_2'),
    key: 'keypair',
  },
  image: {
    label: i18n.t('db.text_3'),
    key: 'image',
  },
  password: {
    label: i18n.t('db.text_4'),
    key: 'password',
  },
}

export const RDS_ACCOUNT_PRIVILEGES = {
  rw: i18n.t('db.text_5'),
  r: i18n.t('db.text_6'),
  ddl: i18n.t('db.text_7'),
  dml: i18n.t('db.text_8'),
  owner: i18n.t('db.text_9'),
  custom: i18n.t('db.text_10'),
}

export const RDS_MONITOR_ALL_OPTS = [
  {
    name: 'cpu',
    label: i18n.t('db.text_11'),
    seleteItem: 'usage_active',
    fromItem: 'rds_cpu',
    as: i18n.t('db.text_11'),
    unit: '%',
    transfer: 1,
    supportBrands: ['huawei', 'hcso', 'hcs', 'aliyun', 'remotefile', 'apsara', 'azure', 'jdcloud', 'qcloud', 'aws', 'h3c'],
  },
  {
    name: 'mem',
    label: i18n.t('db.text_12'),
    seleteItem: 'used_percent',
    fromItem: 'rds_mem',
    as: i18n.t('db.text_12'),
    unit: '%',
    transfer: 1,
    supportBrands: ['huawei', 'hcso', 'hcs', 'aliyun', 'remotefile', 'apsara', 'azure', 'jdcloud', 'qcloud', 'h3c'],
  },
  {
    name: 'bps_recv',
    label: i18n.t('db.text_19'),
    seleteItem: 'bps_recv',
    fromItem: 'rds_netio',
    as: i18n.t('db.text_19'),
    unit: 'bps',
    transfer: 1024,
    supportBrands: ['huawei', 'hcso', 'hcs', 'aliyun', 'remotefile', 'apsara', 'azure', 'jdcloud', 'qcloud', 'aws'],
  },
  {
    name: 'bps_sent',
    label: i18n.t('db.text_20'),
    seleteItem: 'bps_sent',
    as: i18n.t('db.text_20'),
    fromItem: 'rds_netio',
    unit: 'bps',
    transfer: 1024,
    supportBrands: ['huawei', 'hcso', 'hcs', 'aliyun', 'remotefile', 'apsara', 'azure', 'jdcloud', 'qcloud', 'aws'],
  },
  {
    name: 'disk',
    label: i18n.t('db.text_13'),
    seleteItem: 'used_percent',
    as: i18n.t('db.text_13'),
    fromItem: 'rds_disk',
    unit: '%',
    transfer: 1,
    supportBrands: ['huawei', 'hcso', 'hcs', 'aliyun', 'remotefile', 'apsara', 'azure', 'jdcloud', 'qcloud', 'h3c'],
  },
  {
    name: 'read_bps',
    label: i18n.t('db.disk_read_io'),
    seleteItem: 'read_bps',
    fromItem: 'rds_diskio',
    as: i18n.t('db.disk_read_io'),
    unit: 'bps',
    transfer: 1024,
    supportBrands: ['huawei', 'hcso', 'hcs'],
  },
  {
    name: 'write_bps',
    label: i18n.t('db.disk_write_io'),
    seleteItem: 'write_bps',
    fromItem: 'rds_diskio',
    as: i18n.t('db.disk_write_io'),
    unit: 'bps',
    transfer: 1024,
    supportBrands: ['huawei', 'hcso', 'hcs'],
  },
  {
    name: 'diskio',
    label: i18n.t('db.text_385'), // io使用率
    seleteItem: 'used_percent',
    fromItem: 'rds_diskio',
    as: i18n.t('db.text_385'),
    unit: '%',
    transfer: 1,
    supportBrands: ['azure'],
  },
  {
    name: 'conn',
    label: i18n.t('db.used_count'),
    seleteItem: 'used_count',
    as: i18n.t('db.used_count'),
    fromItem: 'rds_conn',
    unit: '',
    selectType: 'last',
    transfer: 1,
    supportBrands: ['huawei', 'hcso', 'hcs', 'aws', 'qcloud'],
  },
  {
    name: 'active_count',
    label: i18n.t('db.text_386'), // 数据库有效连接数
    seleteItem: 'active_count',
    as: i18n.t('db.text_386'),
    fromItem: 'rds_conn',
    unit: '',
    transfer: 1,
    supportBrands: ['azure'],
  },
  {
    name: 'conn',
    label: i18n.t('db.text_18'),
    seleteItem: 'used_percent',
    as: i18n.t('db.text_13'),
    fromItem: 'rds_conn',
    unit: '%',
    transfer: 1,
    supportBrands: ['aliyun', 'remotefile', 'apsara', 'qcloud'],
  },
  {
    name: 'failed_count',
    label: i18n.t('db.text_387'), // 数据库失败连接数
    seleteItem: 'failed_count',
    as: i18n.t('db.text_387'),
    fromItem: 'rds_conn',
    unit: '',
    transfer: 1,
    supportBrands: ['azure'],
  },
  {
    name: 'qps',
    label: i18n.t('db.query_qps'),
    seleteItem: 'query_qps',
    as: i18n.t('db.query_qps'),
    fromItem: 'rds_qps',
    unit: '',
    transfer: 1,
    supportBrands: ['huawei', 'hcso', 'hcs', 'qcloud'],
  },
  {
    name: 'tps',
    label: i18n.t('db.trans_qps'),
    seleteItem: 'trans_qps',
    as: i18n.t('db.trans_qps'),
    fromItem: 'rds_tps',
    unit: '',
    transfer: 1,
    supportBrands: ['huawei', 'hcso', 'hcs', 'qcloud'],
  },
  {
    name: 'innodb_read_bps',
    label: i18n.t('db.innodb_read_io'),
    seleteItem: 'read_bps',
    as: i18n.t('db.innodb_read_io'),
    fromItem: 'rds_innodb',
    unit: 'bps',
    transfer: 1024,
    supportBrands: ['huawei', 'hcso', 'hcs', 'qcloud'],
  },
  {
    name: 'innodb_write_bps',
    label: i18n.t('db.innodb_write_io'),
    seleteItem: 'read_bps',
    as: i18n.t('db.innodb_write_io'),
    fromItem: 'rds_innodb',
    unit: 'bps',
    transfer: 1024,
    supportBrands: ['huawei', 'hcso', 'hcs', 'qcloud'],
  },
]

export const REDIS_MONITOR_ALL_OPTS = [
  {
    name: 'cpu',
    label: i18n.t('db.text_11'),
    seleteItem: 'usage_active',
    fromItem: 'dcs_cpu',
    as: i18n.t('db.text_11'),
    unit: '%',
    transfer: 1,
    supportBrands: ['aliyun', 'huawei', 'azure', 'apsara', 'aws', 'qcloud'],
  },
  {
    name: 'mem',
    label: i18n.t('db.text_12'),
    seleteItem: 'used_percent',
    fromItem: 'dcs_mem',
    as: i18n.t('db.text_12'),
    unit: '%',
    transfer: 1,
    supportBrands: ['aliyun', 'huawei', 'azure', 'apsara', 'qcloud'],
  },
  {
    name: 'dcs_bps_recv',
    label: i18n.t('db.text_21'),
    seleteItem: 'bps_recv',
    fromItem: 'dcs_netio',
    as: i18n.t('db.text_21'),
    unit: 'bps',
    transfer: 1024,
    supportBrands: ['aliyun', 'huawei', 'apsara', 'qcloud'],
  },
  {
    name: 'dcs_bps_sent',
    label: i18n.t('db.text_22'),
    seleteItem: 'bps_sent',
    as: i18n.t('db.text_22'),
    fromItem: 'dcs_netio',
    unit: 'bps',
    transfer: 1024,
    supportBrands: ['aliyun', 'huawei', 'apsara', 'qcloud'],
  },
  {
    name: 'used_conn',
    label: i18n.t('db.text_23'),
    seleteItem: 'used_conn',
    as: i18n.t('db.text_23'),
    fromItem: 'dcs_conn',
    unit: '',
    transfer: 1,
    supportBrands: ['aliyun', 'huawei', 'azure', 'apsara', 'aws', 'qcloud'],
  },
  {
    name: 'opt_sec',
    label: i18n.t('db.text_24'),
    seleteItem: 'opt_sec',
    as: i18n.t('db.text_24'),
    fromItem: 'dcs_instantopt',
    unit: '',
    transfer: 1,
    supportBrands: ['aliyun', 'huawei', 'azure', 'apsara', 'qcloud'],
  },
  {
    name: 'key_count',
    label: i18n.t('db.text_25'),
    seleteItem: 'key_count',
    as: i18n.t('db.text_25'),
    fromItem: 'dcs_cachekeys',
    unit: '',
    transfer: 1,
    supportBrands: ['aliyun', 'huawei', 'azure', 'apsara', 'qcloud'],
  },
  {
    name: 'key_count',
    label: i18n.t('db.text_26'),
    seleteItem: 'expire_key_count',
    as: i18n.t('db.text_26'),
    fromItem: 'dcs_cachekeys',
    unit: '',
    transfer: 1,
    supportBrands: ['aliyun', 'huawei', 'azure', 'apsara', 'aws', 'qcloud'],
  },
  {
    name: 'used_byte',
    label: i18n.t('db.text_27'),
    seleteItem: 'used_byte',
    as: i18n.t('db.text_27'),
    fromItem: 'dcs_datamem',
    unit: 'B',
    transfer: 1024,
    supportBrands: ['aliyun', 'huawei', 'azure', 'apsara', 'qcloud'],
  },
]
